import {post,del,fetch} from './http'

// 修改商品信息
export const goodsUpdate = function (data) {
    return new Promise((resolve, reject) => {
        post('/rubbish-server/goods/update', data).then(res =>{
            resolve(res)
        }).catch(err => {
            reject(err)
        })
    })
}
// 创建
export const goodsCreate = function (data) {
    return new Promise((resolve, reject) => {
        post('/rubbish-server/goods/create', data).then(res =>{
            resolve(res)
        }).catch(err => {
            reject(err)
        })
    })
}
// 获取全部商品分类信息
export const getAllGoods = function (data) {
    return new Promise((resolve, reject) => {
        fetch('/rubbish-server/goods/all', data).then(res =>{
            resolve(res)
        }).catch(err => {
            reject(err)
        })
    })
}
// 删除
export const dellGoodsById = function (data) {
    return new Promise((resolve, reject) => {
        del('/rubbish-server/goods/'+ data, data).then(res =>{
            resolve(res)
        }).catch(err => {
            reject(err)
        })
    })
}